package com.zqj.project.common.util;

import cn.hutool.core.text.CharSequenceUtil;

import java.io.Serializable;

/**
 * @Description: DefValueHelper
 * @Author: 22001010704 Zhang Qijian
 * @CreateTime: 2024/6/12 23:38
 * @Version: 1.0
 */
public final class DefValueHelper {

    private DefValueHelper() {
        throw new IllegalStateException("Utility Class");
    }

    public static String getOrDef(String val, String def) {
        return CharSequenceUtil.isEmpty(val) ? def : val;
    }

    public static <T extends Serializable> T getOrDef(T val, T def) {
        return val == null ? def : val;
    }

}